﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@Html.AjaxDropdown("RoomId");
<div id="calendar">
</div>
<script type="text/javascript">
    $(document).ready(function () {
        doit('@Url.Action("GetEvents", "Calendar", new { CaseId = ViewBag.CaseId })');
        $('#RoomId').change(function () {
            doit('@Url.Action("GetEvents", "Calendar", new { CaseId = ViewBag.CaseId })&RoomId=' + $("#RoomId").val());
        });
    });

    function doit(url) {

        $('#calendar').fullCalendar( 'destroy' ).fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },

            theme: true,
            defaultView: 'agendaDay',
            editable: false,
            events: url
        });

    }
</script>
